package com.xbongbong.saas.model;

import com.xbongbong.paas.domain.entity.PaasFormSubDataEntity;
import com.xbongbong.paas.enums.DelEnum;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.pro.domain.entity.UpdateDataEntity;
import com.xbongbong.saas.domain.entity.CostAdjustSubDataEntity;
import com.xbongbong.saas.domain.entity.ProductSubDataEntity;
import com.xbongbong.saas.domain.entity.competitor.CompetitorSubDataEntity;
import org.elasticsearch.action.support.WriteRequest;

import java.util.List;
import java.util.Map;

/**
 * @author gaojie
 * @version v1.0
 * @date 2022/8/18 10:30
 * @description
 */

public interface CompetitorSubDataModel extends IModel<CompetitorSubDataEntity> {

    @Override
    Integer insert(CompetitorSubDataEntity entity) throws XbbException;

    @Override
    Integer update(CompetitorSubDataEntity entity) throws XbbException;

    @Override
    List<ProductSubDataEntity> findEntitys(Map<String, Object> param);

    @Override
    Integer getEntitysCount(Map<String, Object> param);

    Integer updateBatch(List<UpdateDataEntity> updateDataList, String corpid) throws XbbException;

    /**
     * 根据实体批量修改
     *
     * @param list   调整单子表单实体类集合
     * @param corpid 公司ID
     * @return 影响条数
     * @throws XbbException 异常
     */
    Integer updateBatchByEntity(List<? extends PaasFormSubDataEntity> list, String corpid) throws XbbException;
    /**
     * 批量添加
     *
     * @param entities 竞争对手子表单实体类集合
     * @return 影响条数
     * @throws XbbException 异常
     */
    Integer insertBatch(List<CompetitorSubDataEntity> entities) throws XbbException;

    /**
     * 根据dataId查询子表单
     *
     * @param dataId 数据ID
     * @param corpid 公司ID
     * @return 子表单集合
     */
    List<CompetitorSubDataEntity> getByDataId(Long dataId, String corpid);

    /**
     * 批量删除子表单
     *
     * @param corpid        公司ID
     * @param entities      子表单实体类集合
     * @param refreshPolicy WriteRequest.RefreshPolicy
     * @return 影响条数
     * @throws XbbException 异常
     */
    Integer deleteBatch(String corpid, List<CompetitorSubDataEntity> entities, WriteRequest.RefreshPolicy refreshPolicy) throws XbbException;

    /**
     * 修改删除
     *
     * @param updateDelList 子表单实体类集合
     * @param corpid        公司ID
     * @param refreshPolicy WriteRequest.RefreshPolicy
     * @param delEnum       是否删除 @see {@link DelEnum}
     * @return 影响条数
     * @throws XbbException 异常
     */
    Integer updateDel(List<? extends PaasFormSubDataEntity> updateDelList, String corpid, WriteRequest.RefreshPolicy refreshPolicy, DelEnum delEnum) throws XbbException;

}
